package cn.com.code.design.impl;

import cn.com.code.design.AwardRes;
import cn.com.code.design.ICommondity;
import cn.com.code.design.PrizeController;
import cn.com.code.design.coupon.CouponResult;
import cn.com.code.design.coupon.CouponService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * 优惠券
 *
 * @author zhengpei
 * @date 2021/9/12
 */
public class CouponCommodityService implements ICommondity {

  private Logger logger = LoggerFactory.getLogger(CouponCommodityService.class);
  private CouponService couponService = new CouponService();

  @Override
  public void sendCommodity(String uId, String commodityId, String bizId, Map<String, String> extMap) throws Exception {
    CouponResult couponResult = couponService.sendCoupon(uId, commodityId, bizId);
    if (!"0000".equals(couponResult.getCode())) {
      throw new RuntimeException(couponResult.getInfo());
    }

  }

}
